package com.zzh.jetpackdemo.extension

import android.app.Activity
import android.content.Intent
import android.os.Bundle

/**
 * @author zhangzhihao
 * @email zhangzhihao@gongjiangren.net
 * @date 2020-08-19
 * @desc
 */

fun Activity.myStartActivity(cls: Class<*>, bun: Bundle? = null, code: Int = -1) {
    var toIntent = Intent(this, cls)
    bun?.let {
        toIntent.putExtras(bun)
    }
    if (code == -1) {
        startActivityForResult(toIntent, code)
    } else {
        startActivity(toIntent)
    }
}


